package com.msh.artascope.client.model;

import com.msh.artascope.interfaces.IAccountMenu;
import com.msh.frame.client.common.ITreeConstructor;
import com.msh.frame.client.util.LayerCodeUtil;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import lombok.Data;

@Data
public class AccountMenu implements IAccountMenu, ITreeConstructor<AccountMenu>, Serializable {
  private Long id;
  private String name;
  private String code;
  private String type;
  private int layer;
  private String path;
  private Map<String, Object> param;
  private List<AccountMenu> children;

  @Override
  public Object key() {
    return this.code;
  }

  @Override
  public Object parentKey() {
    return LayerCodeUtil.getParentCode(this.code);
  }

  @Override
  public boolean layerOne() {
    return this.layer == 1;
  }

  @Override
  public List<AccountMenu> getChildren() {
    return this.children;
  }

  @Override
  public AccountMenu setChildren(List<AccountMenu> list) {
    this.children = list;
    return this;
  }
}
